package com.beadhouse.base.web.controller;

import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import javax.validation.constraints.NotBlank;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.beadhouse.base.dto.MenuListDto;
import com.beadhouse.base.service.MenuService;
import com.beadhouse.common.dto.JSONResponse;
import com.beadhouse.entity.RoleMenuEntity;
import com.beadhouse.entity.UserEntity;

@Controller
public class MenuController {
	@Autowired
	MenuService mServcie;
	@RequestMapping("/api/base/getMenu")
	@ResponseBody
	public JSONResponse menuList(HttpServletRequest req) {
		HttpSession session=req.getSession();
		UserEntity u=(UserEntity) session.getAttribute(UserEntity.class.getName());
		MenuListDto mld=mServcie.getMenu(u.getRole().getId());
		return JSONResponse.ok(mld);
	}
}
